package com.company.managesystem.util;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * 本地存储数据
 * Created by lqy on 2017/8/17.
 */

public class SharePreferenceUtil {
    private SharedPreferences sp;
    private SharedPreferences.Editor editor;

    public SharePreferenceUtil(Context context) {
        sp = context.getSharedPreferences("HouQin", context.MODE_PRIVATE);
        editor = sp.edit();
    }

    //维修人ID
    public void setJsrCode(String JsrCode) {
        editor.putString("code", JsrCode);
        editor.commit();
    }

    public String getJsrCode() {
        return sp.getString("code", "");
    }

    // 用户密码
    public void setPassword(String password) {
        editor.putString("passwd", password);
        editor.commit();
    }

    public String getPassword() {
        return sp.getString("passwd", "");
    }

    // 用户姓名
    public void setName(String name) {
        editor.putString("name", name);
        editor.commit();
    }

    public String getName() {
        return sp.getString("name", "");
    }

    // 医院名称
    public void setHospital(String hospital) {
        editor.putString("hospital", hospital);
        editor.commit();
    }

    public String getHospital() {
        return sp.getString("hospital", "");
    }

    // 所属部门
    public void setDepartment(String department) {
        editor.putString("department", department);
        editor.commit();
    }

    public String getDepartment() {
        return sp.getString("department", "");
    }
}
